﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
using LightSwitchApplication.UserCode;

namespace LightSwitchApplication
{
    public partial class ServerJobs
    {
        partial void FirstInit_Execute()
        {
            System.Windows.MessageBoxResult result = this.ShowMessageBox("Are you sure you want to initialize the database? This could brake the Database if not used correctly!"
                ,"Confirm Initialisation"
                ,MessageBoxOption.YesNo);

            if(result == System.Windows.MessageBoxResult.No)
                return;

            ServerJobFactory Job = new ServerJobFactory(this.DataWorkspace.ApplicationData);
            Job.CreateJob("FirstInit");
            Job.SaveJob();
        }
    }
}
